/**
 * 
 */
package any.json;

import java.util.Date;

import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonBeanProcessor;

/**
 * @author keke<keke@codehaus.org>
 * @version $Revision: 31 $
 */
public class DateBeanProcessor implements JsonBeanProcessor {

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.sf.json.processors.JsonBeanProcessor#processBean(java.lang.Object,
	 *      net.sf.json.JsonConfig)
	 */
	public JSONObject processBean(final Object arg0, final JsonConfig arg1) {
		final JSONObject obj = new JSONObject();
		obj.put("$", ((Date) arg0).getTime());
		obj.put("type", arg0.getClass().getName());
		return obj;
	}

}
